﻿using System;

namespace CardLib
{
	public class Card:ICloneable
	{
		public readonly Rank rank;
		public readonly Suit suit;

		private Card()
		{
		}

		public Card(Suit suit1, Rank rank1)
		{
			suit = suit1;
			rank = rank1;
		}

		public override string ToString()
		{
			return "ranK:" + rank + " suit:" + suit;
		}

		public object Clone()
		{
			return MemberwiseClone();
		}

		public static bool operator ==(Card card1, Card card2)
		{
			return (card1.suit == card2.suit) && (card1.rank == card2.rank);
		}

		public static bool operator !=(Card card1, Card card2)
		{
			return !(card1 == card2);
		}
		
		public static bool operator >(Card card1, Card card2)
		{
			if (card1.suit == card2.suit)
			{
				return (card1.rank > card2.rank);
			}
			else
			{
				return card1.suit > card2.suit;
			}
		}
		public static bool operator <(Card card1, Card card2)
		{
			return !(card1 == card2) && !(card1 > card2);
		}

		public static bool operator >=(Card card1, Card card2)
		{
			return card1 == card2 || card1 > card2;
		}
		public static bool operator <=(Card card1, Card card2)
		{
			return card1 == card2 || card1 < card2;
		}
	}
}